import { Project } from "screen/project-list/list";
import { MjcResponseData } from "service/type";
import MJCrequesting from "../index";
import { MjcRequestConfig } from "../request/type";
import { editProjectRequest } from "./type";
enum ProjectApi {
  AccounEdit = "/project/editProject",
  AddProjectId = "/project/AddProject",
  DetailProject = "/project/DetailProject",
}
const DEFAULT_HEADERS = {
  "Content-Type": "application/json",
};
const NONE_HEADERS = {
  "Content-Type": "none",
};
export const getProject = (url: string) => {
  return MJCrequesting.get({ url });
};
export const editProject = <T = any>(data: Partial<editProjectRequest>) => {
  return MJCrequesting.request<T>({
    url: ProjectApi.AccounEdit,
    method: "POST",
    headers: DEFAULT_HEADERS,
    data: data,
  });
};
export const addProject = <T = MjcResponseData>(data: Partial<Project>) => {
  return MJCrequesting.request<T>({
    url: ProjectApi.AddProjectId,
    method: "POST",
    headers: DEFAULT_HEADERS,
    data: data,
  });
};
export const detailProject = <T = MjcResponseData>(id: number) => {
  return MJCrequesting.request<T>({
    url: ProjectApi.DetailProject + `/${id}`,
    method: "GET",
    headers: NONE_HEADERS,
  });
};
